import { createParamDecorator, ExecutionContext } from '@nestjs/common';

export const PayloadUser = createParamDecorator(
  (data, ctx: ExecutionContext) => {
    const request = ctx.switchToHttp().getRequest();
    if (request.user) {
      return request.user as SC.User.SysInfo;
    }

    return null;
  },
);
